/*
 * Copyright (c) 2018, apexes.net. All rights reserved.
 *
 *         http://www.apexes.net
 *
 */
package net.apexes.demo.codegen.entity.base;

import net.apexes.demo.codegen.entity.enums.StatusFlag;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author <a href="mailto:hedyn@foxmail.com">HeDYn</a>
 */
public abstract class EntityBase implements java.io.Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private String id;

    private StatusFlag statusFlag;

    private String version;

    private String crtWho;

    private LocalDateTime crtTime;

    private String updWho;

    private LocalDateTime updTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public StatusFlag getStatusFlag() {
        return statusFlag;
    }

    public void setStatusFlag(StatusFlag statusFlag) {
        this.statusFlag = statusFlag;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCrtWho() {
        return crtWho;
    }

    public void setCrtWho(String crtWho) {
        this.crtWho = crtWho;
    }

    public LocalDateTime getCrtTime() {
        return crtTime;
    }

    public void setCrtTime(LocalDateTime crtTime) {
        this.crtTime = crtTime;
    }

    public String getUpdWho() {
        return updWho;
    }

    public void setUpdWho(String updWho) {
        this.updWho = updWho;
    }

    public LocalDateTime getUpdTime() {
        return updTime;
    }

    public void setUpdTime(LocalDateTime updTime) {
        this.updTime = updTime;
    }

    @Override
    public String toString() {
        return getClass().getName() + ":"
                + "id=" + id
                + ",statusFlag=" + statusFlag
                + ",version=" + version
                + ",crtWho=" + crtWho
                + ",crtTime=" + crtTime
                + ",updWho=" + updWho
                + ",updTime=" + updTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        EntityBase that = (EntityBase) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}
